USE CourierDatabase
GO
CREATE PROCEDURE checkLogin
@loginName VARCHAR(50),
@password VARCHAR(100),
@haveEmp INT OUTPUT,
@decentralization INT OUTPUT
AS
BEGIN
	SET @haveEmp = (SELECT COUNT(*) FROM CourierDatabase.dbo.Employee
	WHERE Login_Name = @loginName and Login_Password = @password)
	IF(@haveEmp = 1)
	BEGIN
		SET @decentralization = (SELECT Decentralization_Id FROM CourierDatabase.dbo.Employee
		WHERE Login_Name = @loginName)
	END
END
GO

CREATE PROCEDURE checkForgotPassword
@loginName VARCHAR(50),
@question INT,
@answer VARCHAR(100),
@check INT OUTPUT
AS
BEGIN
	SET @check = (SELECT COUNT(*) FROM CourierDatabase.dbo.Employee 
	WHERE (@loginName = Login_Name AND @question = S_Question AND @answer = S_Answer))
END
GO